<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>橡树科技－JavaDemoSystem</title>
    <script src="/js/jquery-1.12.4.js"></script>
    <link type="text/css" rel="stylesheet" media="all" href="/static/styles/global.css"
          tppabs="http://demo.mycodes.net/houtai/isoakJavaDemoSystem/styles/global.css"/>
    <link type="text/css" rel="stylesheet" media="all" href="/static/styles/global_color.css"
          tppabs="http://demo.mycodes.net/houtai/isoakJavaDemoSystem/styles/global_color.css"/>
    <script language="javascript" type="text/javascript">
        //保存成功的提示信息
        function showResult() {
            showResultDiv(true);
            window.setTimeout("showResultDiv(false);", 3000);
        }

        function showResultDiv(flag) {
            var divResult = document.getElementById("save_result_info");
            if (flag)
                divResult.style.display = "block";
            else
                divResult.style.display = "none";
        }

        //ajax 比对旧密码
        $(function () {
            $("#oldPwd").blur(function () {
                var oldpwd = $("#oldPwd").val();
                var accountId = $("#accountId").val();
                $.ajax({
                    url: "/account/accountpwd",
                    type: "post",
                    data: {"oldpwd": oldpwd, "accountId": accountId},
                    success: function (resultMap) {
                        if (resultMap.code == 1001) {
                            $("#oldPwdNoError_msg").show()
                            $("#oldPwd_msg").hide()
                            document.getElementById("submit").disabled = true;
                        } else {
                            $("#oldPwd_msg").show()
                            $("#oldPwdNoError_msg").hide()
                            document.getElementById("submit").disabled = false;
                        }
                    }
                });
            })
        })


        //校验两次密码
        function pwd() {
            var newpwd = document.getElementById("newpwd").value;
            var newpwd2 = document.getElementById("newpwd2").value;
            if ((newpwd == newpwd2) && (newpwd != "")) {
                document.getElementById("tishi").innerHTML = "<br><font color='green'>可用</font>";
                document.getElementById("submit").disabled = false;
            } else if (newpwd == "" || newpwd2 == "") {
                document.getElementById("tishi").innerHTML = "<br><font color='red'>密码不能为空!</font>";
                document.getElementById("submit").disabled = true;
            } else if (newpwd != newpwd2) {
                document.getElementById("tishi").innerHTML = "<br><font color='red'>两次输入密码不一致!</font>";
                document.getElementById("submit").disabled = true;
            }
        }

        //显示修改密码的信息项
        function showPwd(chkObj) {
            if (chkObj.checked)
                document.getElementById("divPwds").style.display = "block";
            else
                document.getElementById("divPwds").style.display = "none";
        }
    </script>
</head>
<body>

<div id="header">
    <img src="/static/images/logo.png" tppabs="http://demo.mycodes.net/houtai/isoakJavaDemoSystem/images/logo.png"
         alt="logo" class="left"/>
    <a href="#">[退出]</a>
</div>


<div id="navi">
    <ul id="menu">
        <li><a href="../index.html" tppabs="http://demo.mycodes.net/houtai/isoakJavaDemoSystem/index.html"
               class="index_off"></a></li>
        <li><a href="../role/role_list.html"
               tppabs="http://demo.mycodes.net/houtai/isoakJavaDemoSystem/role/role_list.html" class="role_off"></a>
        </li>
        <li><a href="../admin/admin_list.html"
               tppabs="http://demo.mycodes.net/houtai/isoakJavaDemoSystem/admin/admin_list.html" class="admin_off"></a>
        </li>
        <li><a href="../fee/fee_list.html" tppabs="http://demo.mycodes.net/houtai/isoakJavaDemoSystem/fee/fee_list.html"
               class="fee_off"></a></li>
        <li><a href="/account/account_list"
               tppabs="http://demo.mycodes.net/houtai/isoakJavaDemoSystem/account/account_list.html"
               class="account_on"></a></li>
        <li><a href="../service/service_list.html"
               tppabs="http://demo.mycodes.net/houtai/isoakJavaDemoSystem/service/service_list.html"
               class="service_off"></a></li>
        <li><a href="../bill/bill_list.html"
               tppabs="http://demo.mycodes.net/houtai/isoakJavaDemoSystem/bill/bill_list.html" class="bill_off"></a>
        </li>
        <li><a href="../report/report_list.html"
               tppabs="http://demo.mycodes.net/houtai/isoakJavaDemoSystem/report/report_list.html"
               class="report_off"></a></li>
        <li><a href="../user/user_info.html"
               tppabs="http://demo.mycodes.net/houtai/isoakJavaDemoSystem/user/user_info.html"
               class="information_off"></a></li>
        <li><a href="../user/user_modi_pwd.html"
               tppabs="http://demo.mycodes.net/houtai/isoakJavaDemoSystem/user/user_modi_pwd.html"
               class="password_off"></a></li>
    </ul>
</div>


<div id="main">
    <div id="save_result_info" class="save_fail">保存成功</div>
    <div id="save_result_info" class="save_fail">保存失败!!</div>
    <form action="/account/account_modi" method="post" class="main_form">
        <div class="text_info clearfix"><span>账务账号ID：</span></div>
        <div class="input_info">
            <input type="text" id="accountId" value="${account.accountId}" name="accountId" readonly class="readonly"/>
        </div>
        <div class="text_info clearfix"><span>真实姓名：</span></div>
        <div class="input_info">
            <input type="text" value="${account.realName}" name="realName"/>
            <%--<span class="required">*</span>--%>
            <%--<div class="validate_msg_long error_msg" style="width: 350px;">20长度以内的汉字、字母和数字的组合</div>--%>
        </div>
        <div class="text_info clearfix"><span>身份证：</span></div>
        <div class="input_info">
            <input type="text" value="${account.idcardNo}" readonly class="readonly"/>
        </div>
        <div class="text_info clearfix"><span>登录账号：</span></div>
        <div class="input_info">
            <input type="text" value="${account.loginName}" readonly class="readonly"/>
            <div class="change_pwd">
                <input id="chkModiPwd" type="checkbox" onClick="showPwd(this);"/>
                <label for="chkModiPwd">修改密码</label>
            </div>
        </div>

        <div id="divPwds">
            <div class="text_info clearfix"><span>旧密码：</span></div>
            <div class="input_info">
                <input type="password" id="oldPwd" name="oldPwd" onblur="oldPwd()"/>
                <span id="oldPwdNoError_msg" hidden="hidden" style="color: red;">密码不正确</span>
                <span id="oldPwd_msg" hidden="hidden" style="color: green;">正确</span>
                <%--<div class="validate_msg_long">30长度以内的字母、数字和下划线的组合</div>--%>
            </div>
            <div class="text_info clearfix"><span>新密码：</span></div>
            <div class="input_info">
                <input type="password" id="newpwd"/>
                <%--<span class="required">*</span>--%>
                <%--<div class="validate_msg_long">30长度以内的字母、数字和下划线的组合</div>--%>
            </div>

            <span id="tishi" style="margin-left: 20px;"></span>
            <div class="text_info clearfix"><span>重复新密码：</span></div>
            <div class="input_info">
                <input type="password" id="newpwd2" name="loginPasswd" onblur="pwd()"/>
                <%--<span class="required">*</span>--%>
                <%--<div class="validate_msg_long">两次密码必须相同</div>--%>
                <span id="PwdNoError_msg" hidden="hidden" style="color: red;">密码不正确</span>
                <span id="Pwd_msg" hidden="hidden" style="color: green;">正确</span>
            </div>
        </div>
        <div class="text_info clearfix"><span>电话：</span></div>
        <div class="input_info">
            <input type="text" class="width200" name="telephone" value="${account.telephone}"/>
            <%--<span class="required">*</span>--%>
            <%--<div class="validate_msg_medium error_msg">正确的电话号码格式：手机或固话</div>--%>
        </div>
        <div class="text_info clearfix"><span>推荐人身份证号码：</span></div>
        <div class="input_info">
            <input type="text" value="${account.idcardNo}" disabled/>
            <div class="validate_msg_long error_msgs">正确的身份证号码格式</div>
        </div>
        <div class="text_info clearfix"><span>生日：</span></div>
        <div class="input_info">
            <input type="date" value="<fmt:formatDate value="${account.birthdate}" pattern="yyyy-MM-dd"/>" readonly
                   class="readonly"/>
        </div>
        <div class="text_info clearfix"><span>Email：</span></div>
        <div class="input_info">
            <input type="text" class="width200" name="email" value="${account.email}"/>
            <div class="validate_msg_medium">50长度以内，合法的 Email 格式</div>
        </div>
        <div class="text_info clearfix"><span>职业：</span></div>
        <div class="input_info">
            <select name="occupation">
                <option>技术人员</option>
                <option>干部</option>
                <option>学生</option>
                <option>其他</option>
            </select>
        </div>
        <div class="text_info clearfix"><span>性别：</span></div>
        <div class="input_info fee_type">
            <c:if test="${account.gender == '1'}">
                <input type="radio" name="gender" value="1" checked="checked" id="female"/>
                <label for="female">女</label>
                <input type="radio" name="gender" value="0" id="male"/>
                <label for="male">男</label>
            </c:if>
            <c:if test="${account.gender == '0'}">
                <input type="radio" name="gender" value="1" id="female"/>
                <label for="female">女</label>
                <input type="radio" name="gender" value="0" checked="checked" id="male"/>
                <label for="male">男</label>
            </c:if>
        </div>
        <div class="text_info clearfix"><span>通信地址：</span></div>
        <div class="input_info">
            <input type="text" class="width350" name="mailaddress" value="${account.mailaddress}"/>
            <div class="validate_msg_tiny">50长度以内</div>
        </div>
        <div class="text_info clearfix"><span>邮编：</span></div>
        <div class="input_info">
            <input type="text" name="zipcode" value="${account.zipcode}"/>
            <div class="validate_msg_long">6位数字</div>
        </div>
        <div class="text_info clearfix"><span>QQ：</span></div>
        <div class="input_info">
            <input type="text" name="qq" value="${account.qq}"/>
            <div class="validate_msg_long">5到13位数字</div>
        </div>

        <div class="button_info clearfix">
            <input type="submit" id="submit" value="保存" class="btn_save"/>
            <input type="button" value="取消" class="btn_save" onclick="location.href='/account/account_list'"/>
            <span>${success}</span>
        </div>
    </form>
</div>

<div id="footer">
    <span>[源自橡树的技术，最优秀的师资，最真实的企业环境，最适用的实战项目]</span>
    <br/>
    <span>版权所有(C)橡树信息科技有限公司 </span>
</div>
</body>
</html>
